package com.xiaoy.core.portal.simple;

import java.io.IOException;
import java.util.Map.Entry;

import org.springframework.stereotype.Service;

import com.xiaoy.core.portal.api.TaskGeneratorAdapt;
import com.xiaoy.core.portal.api.entity.TaskPortlet;
import com.xiaoy.util.format.FileUtil;
import com.xiaoy.util.store.VariableStore;

@Service("taskSimpleGenerator")
public class TaskSimpleGenerator extends TaskGeneratorAdapt{

	
	private String[] attrs = new String[]{""};
	
	private String fileName = "config";
	
	
	@Override
	public String create(TaskPortlet task) {
		
		try {
			return init(task);
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return "";
	}
	
	
	private String init (TaskPortlet task) throws IOException {
		
		for (Entry<String, String> e:VariableStore.vs.entrySet()) {
//			System.out.println("map:"+e.getKey()+"-->"+e.getValue());
		}
		;
//		System.out.println("read before-->"+getClass().getClassLoader().getResourceAsStream(fileName).toString());
		
//		fileName = getClass().getClassLoader().getResource(fileName).getPath();
		
		
//		StringBuilder content = new StringBuilder(FileUtil.read(fileName));
//		
//		System.out.println("content-->"+content);
//		
//		for (String attr : attrs) {
//			
////			"".replace(oldChar, newChar)
//		}
//		
//		return content.toString();
		
		return "";
	}
	
	
	public static void main(String[] args) {
		
//		new TaskSimpleGenerator().create(new TaskPortlet());
		
		
		System.out.println(System.getProperty("user.dir"));
		
		
	}
	
}
